﻿using Microsoft.AspNetCore.Blazor.Browser.Interop;

using System;
using System.Collections.Generic;

using System.Linq;
using System.Threading.Tasks;

namespace SIGBugs.Client.Libs
{
    public static class JsInterop
    {
        public static void SetHeaderStatus()
        {
            var result = RegisteredFunction.Invoke<string>("setHeaderStatus");         
        }

        public static void GoHome()
        {
            var result = RegisteredFunction.Invoke<string>("goHome");

        }

        public static void SetToken(string token,string username)
        {
            RegisteredFunction.Invoke<object>("Auth.SetToken", token, username);
        }

        public static string GetToken()
        {       
            var result = RegisteredFunction.Invoke<string>("Auth.GetToken");
            return result.ToString();           
        }

        public static string GetUsername()
        {
            var result = RegisteredFunction.Invoke<string>("Auth.GetUsername");
            return result.ToString();
        }

        public static void RemoveToken()
        {
            RegisteredFunction.Invoke<object>("Auth.RemoveToken");
        }

    }
}
